#include <stdio.h>

int main()
{
	int num[13] = {0};
	int pok = 0;
	for ( int i = 0; i < 25; i++ ) {
		scanf("%d", &pok);
		num[pok-1] ++;
	}
	
	int losePok = -1;
	for ( int i = 0; i < 13; i++ ) {
		if ( num[i] < 2 ) {
			losePok	= i + 1;
			break;
		}
	}
	printf("%d", losePok);
}
